////
//// Source code recreated from a .class file by IntelliJ IDEA
//// (powered by FernFlower decompiler)
////
//
//package org.postgresql.jdbc;
//
//import org.postgresql.Driver;
//import org.postgresql.PGNotification;
//import org.postgresql.PGProperty;
//import org.postgresql.bulkload.BulkloadManager;
//import org.postgresql.copy.CopyManager;
//import org.postgresql.core.*;
//import org.postgresql.core.types.PGBlob;
//import org.postgresql.core.types.PGClob;
//import org.postgresql.fastpath.Fastpath;
//import org.postgresql.geometric.*;
//import org.postgresql.largeobject.LargeObjectManager;
//import org.postgresql.log.Log;
//import org.postgresql.log.Logger;
//import org.postgresql.replication.PGReplicationConnection;
//import org.postgresql.replication.PGReplicationConnectionImpl;
//import org.postgresql.util.*;
//import org.postgresql.xml.DefaultPGXmlFactoryFactory;
//import org.postgresql.xml.LegacyInsecurePGXmlFactoryFactory;
//import org.postgresql.xml.PGXmlFactoryFactory;
//
//import java.io.File;
//import java.io.IOException;
//import java.lang.reflect.Array;
//import java.net.URISyntaxException;
//import java.sql.*;
//import java.util.*;
//import java.util.concurrent.Executor;
//
//public class PgConnection implements BaseConnection {
//    private static final Log LOGGER = Logger.getLogger(PgConnection.class.getName());
//    private static final SQLPermission SQL_PERMISSION_ABORT = new SQLPermission("callAbort");
//    private static final SQLPermission SQL_PERMISSION_NETWORK_TIMEOUT = new SQLPermission("setNetworkTimeout");
//    private static final Map<String, String> CONNECTION_INFO_REPORT_BLACK_LIST = new HashMap();
//    private final Properties _clientInfo;
//    private final String creatingURL;
//    private Throwable openStackTrace;
//    private final QueryExecutor queryExecutor;
//    private BulkloadManager bulkloadManager = null;
//    private final Query commitQuery;
//    private final Query rollbackQuery;
//    private ClientLogic clientLogic = null;
//    private final TypeInfo _typeCache;
//    private boolean disableColumnSanitiser = false;
//    protected int prepareThreshold;
//    protected int defaultFetchSize;
//    protected boolean forcebinary = false;
//    private int rsHoldability = 2;
//    private int savepointId = 0;
//    private boolean autoCommit = true;
//    private boolean readOnly = false;
//    private boolean allowReadOnly = true;
//    public boolean batchInsert = true;
//    public boolean blobmode = true;
//    public boolean timeTextMode = false;
//    private int fetchSize = -1;
//    private final boolean bindStringAsVarchar;
//    private SQLWarning firstWarning = null;
//    private volatile Timer cancelTimer = null;
//    private PreparedStatement checkConnectionQuery;
//    private final boolean replicationConnection;
//    private final LruCache<FieldMetadata.Key, FieldMetadata> fieldMetadataCache;
//    private final String xmlFactoryFactoryClass;
//    private PGXmlFactoryFactory xmlFactoryFactory;
//    private final String socketAddress;
//    private DbCompatibility dbCompatibility;
//    private String bulkloadCtlFile;
//    private Boolean exitCommit;
//    private Boolean forZZKK;
//    private Boolean oraBlobMode;
//    private final TimestampUtils timestampUtils;
//    protected Map<String, Class<?>> typemap;
//    private Fastpath fastpath;
//    private LargeObjectManager largeobject;
//    protected DatabaseMetaData metadata;
//    private CopyManager copyManager;
//
//    final CachedQuery borrowQuery(String sql) throws SQLException {
//        return this.queryExecutor.borrowQuery(sql);
//    }
//
//    final CachedQuery borrowCallableQuery(String sql) throws SQLException {
//        return this.queryExecutor.borrowCallableQuery(sql);
//    }
//
//    private CachedQuery borrowReturningQuery(String sql, String[] columnNames) throws SQLException {
//        return this.queryExecutor.borrowReturningQuery(sql, columnNames);
//    }
//
//    public CachedQuery createQuery(String sql, boolean escapeProcessing, boolean isParameterized, String... columnNames) throws SQLException {
//        return this.queryExecutor.createQuery(sql, escapeProcessing, isParameterized, columnNames);
//    }
//
//    void releaseQuery(CachedQuery cachedQuery) {
//        this.queryExecutor.releaseQuery(cachedQuery);
//    }
//
//    public void setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate) {
//        this.queryExecutor.setFlushCacheOnDeallocate(flushCacheOnDeallocate);
//        LOGGER.debug("  setFlushCacheOnDeallocate = " + flushCacheOnDeallocate);
//    }
//
//    public PgConnection(HostSpec[] hostSpecs, String user, String database, Properties info, String url) throws SQLException {
//        this.dbCompatibility = DbCompatibility.POSTGRESQL;
//        this.exitCommit = false;
//        this.forZZKK = false;
//        this.oraBlobMode = false;
//        this.fastpath = null;
//        this.largeobject = null;
//        this.copyManager = null;
//        LOGGER.debug("Vastbase JDBC Driver 2.9.4423");
//
//        try {
//            if (info.getProperty("fetchsize") != null) {
//                this.fetchSize = Integer.parseInt(info.getProperty("fetchsize"));
//                if (this.fetchSize < 0) {
//                    this.fetchSize = -1;
//                }
//            }
//        } catch (Exception var51) {
//            LOGGER.trace("Catch Exception while transfor fetchsize to integer. ", var51);
//        }
//
//        String bulkloadCtlFile;
//        try {
//            bulkloadCtlFile = info.getProperty("allowReadOnly");
//            if (bulkloadCtlFile != null && !bulkloadCtlFile.trim().equals("") && bulkloadCtlFile.equalsIgnoreCase("FALSE")) {
//                this.allowReadOnly = false;
//            }
//        } catch (Exception var50) {
//            LOGGER.trace("Catch Exception while compare allow and FALSE. ", var50);
//        }
//
//        this.creatingURL = url;
//        this.setDefaultFetchSize(PGProperty.DEFAULT_ROW_FETCH_SIZE.getInt(info));
//        this.setPrepareThreshold(PGProperty.PREPARE_THRESHOLD.getInt(info));
//        if (this.prepareThreshold == -1) {
//            this.setForceBinary(true);
//        }
//
//        if (null != PGProperty.DB_COMPATIBILITY.get(info) && !"".equals(PGProperty.DB_COMPATIBILITY.get(info))) {
//            this.setDbCompatibility(DbCompatibility.of(PGProperty.DB_COMPATIBILITY.get(info)));
//        }
//
//        this.queryExecutor = ConnectionFactory.openConnection(hostSpecs, user, database, info);
//        this.socketAddress = this.queryExecutor.getSocketAddress();
//        if (LOGGER.isWarnEnabled() && !this.haveMinimumServerVersion(ServerVersion.v8_2)) {
//            LOGGER.warn("Unsupported Server Version: " + this.queryExecutor.getServerVersion());
//        }
//
//        bulkloadCtlFile = PGProperty.BULKLOAD_CTL_FILE.get(info);
//        if (bulkloadCtlFile != null) {
//            this.bulkloadCtlFile = bulkloadCtlFile;
//        }
//
//        Set<Integer> binaryOids = getBinaryOids(info);
//        Set<Integer> useBinarySendForOids = new HashSet(binaryOids);
//        Set<Integer> useBinaryReceiveForOids = new HashSet(binaryOids);
//        useBinarySendForOids.remove(1082);
//        this.queryExecutor.setBinaryReceiveOids(useBinaryReceiveForOids);
//        this.queryExecutor.setBinarySendOids(useBinarySendForOids);
//        String stringType = PGProperty.STRING_TYPE.get(info);
//        if (stringType != null) {
//            if (stringType.equalsIgnoreCase("unspecified")) {
//                this.bindStringAsVarchar = false;
//            } else {
//                if (!stringType.equalsIgnoreCase("varchar")) {
//                    throw new PSQLException(GT.tr("Unsupported value for stringtype parameter: " + stringType, new Object[0]), PSQLState.INVALID_PARAMETER_VALUE);
//                }
//
//                this.bindStringAsVarchar = true;
//            }
//        } else {
//            this.bindStringAsVarchar = true;
//        }
//
//        this.timestampUtils = new TimestampUtils(!this.queryExecutor.getIntegerDateTimes(), new Provider<TimeZone>() {
//            public TimeZone get() {
//                return PgConnection.this.queryExecutor.getTimeZone();
//            }
//        });
//        this.commitQuery = this.createQuery("COMMIT", false, true).query;
//        this.rollbackQuery = this.createQuery("ROLLBACK", false, true).query;
//        int unknownLength = PGProperty.UNKNOWN_LENGTH.getInt(info);
//        this._typeCache = this.createTypeInfo(this, unknownLength);
//        this.initObjectTypes(info);
//        if (PGProperty.LOG_UNCLOSED_CONNECTIONS.getBoolean(info)) {
//            this.openStackTrace = new Throwable("Connection was created at this point:");
//        }
//
//        this.disableColumnSanitiser = PGProperty.DISABLE_COLUMN_SANITISER.getBoolean(info);
//        if (this.haveMinimumServerVersion(ServerVersion.v8_3)) {
//            this._typeCache.addCoreType("uuid", 2950, 1111, "java.util.UUID", 2951);
//            this._typeCache.addCoreType("xml", 142, 2009, "java.sql.SQLXML", 143);
//        }
//
//        this._typeCache.addCoreType("clob", 90, 2005, "java.sql.CLOB", 0);
//        this._typeCache.addCoreType("blob", 88, 2004, "java.sql.BLOB", 0);
//        if (this.checkVastBaseVersion("2.2.12")) {
//            this._typeCache.addCoreType("longblob", 89, 2004, "java.sql.BLOB", 0);
//        }
//
//        this._clientInfo = new Properties();
//        String appType;
//        if (this.haveMinimumServerVersion(ServerVersion.v9_0)) {
//            appType = PGProperty.APPLICATION_NAME.get(info);
//            if (appType == null) {
//                appType = "";
//            }
//
//            this._clientInfo.put("ApplicationName", appType);
//        }
//
//        appType = PGProperty.APPLICATION_TYPE.get(info);
//        if (appType == null) {
//            appType = "";
//        }
//
//        this._clientInfo.put("ApplicationType", appType);
//        this.fieldMetadataCache = new LruCache(Math.max(0, PGProperty.DATABASE_METADATA_CACHE_FIELDS.getInt(info)), (long)Math.max(0, PGProperty.DATABASE_METADATA_CACHE_FIELDS_MIB.getInt(info) * 1024 * 1024), false);
//        this.xmlFactoryFactoryClass = PGProperty.XML_FACTORY_FACTORY.get(info);
//        this.replicationConnection = PGProperty.REPLICATION.get(info) != null;
//        if (!this.replicationConnection) {
//            Statement stmtGetGuc = null;
//            ResultSet rsGetGuc = null;
//            Statement stmtSetGuc = null;
//
//            String blobString;
//            String timeTextString;
//            String batchString;
//            String ZZKK;
//            try {
//                blobString = info.getProperty("connectionExtraInfo");
//                timeTextString = "select name, setting from pg_settings where name in ('connection_info')";
//                stmtGetGuc = this.createStatement();
//                rsGetGuc = stmtGetGuc.executeQuery(timeTextString);
//                boolean useConnectionInfo = false;
//                boolean useConnectionExtraInfo = false;
//
//                while(rsGetGuc.next()) {
//                    if (rsGetGuc.getString(1).equalsIgnoreCase("connection_info")) {
//                        useConnectionInfo = true;
//                        useConnectionExtraInfo = Boolean.valueOf(blobString);
//                    }
//                }
//
//                if (useConnectionInfo) {
//                    batchString = this.getConnectionInfo(useConnectionExtraInfo, info);
//                    ZZKK = "set connection_info = '" + batchString.replace("'", "''") + "'";
//                    if (!ZZKK.contains(";")) {
//                        stmtSetGuc = this.createStatement();
//                        stmtSetGuc.executeUpdate(ZZKK);
//                    } else {
//                        LOGGER.debug("connection_info contains \";\", which is not allowed.");
//                    }
//                }
//            } catch (SQLException var54) {
//                LOGGER.trace("Catch SQLException while connection. ", var54);
//            } finally {
//                if (stmtGetGuc != null) {
//                    stmtGetGuc.close();
//                }
//
//                if (rsGetGuc != null) {
//                    rsGetGuc.close();
//                }
//
//                if (stmtSetGuc != null) {
//                    stmtSetGuc.close();
//                }
//
//            }
//
//            blobString = info.getProperty("blobMode");
//            if (blobString != null && blobString.equalsIgnoreCase("OFF")) {
//                this.blobmode = false;
//            }
//
//            timeTextString = info.getProperty("timeTextMode");
//            if (timeTextString != null && timeTextString.equalsIgnoreCase("ON")) {
//                this.timeTextMode = true;
//            }
//
//            if (!this.checkVastBaseVersion("2.2.10")) {
//                this.timeTextMode = false;
//            }
//
//            String exitCommit = info.getProperty("exitCommit");
//            if (exitCommit != null && exitCommit.equalsIgnoreCase("ON")) {
//                this.exitCommit = true;
//                ShutDownThread t = new ShutDownThread();
//                t.setConnection(this);
//                Runtime.getRuntime().addShutdownHook(t);
//            }
//
//            String readOnly = info.getProperty("readOnly");
//            if (readOnly != null && readOnly.equalsIgnoreCase("True")) {
//                this.setReadOnly(true);
//            }
//
//            batchString = info.getProperty("batchMode");
//            if (batchString != null && !batchString.equalsIgnoreCase("AUTO")) {
//                if (batchString.equalsIgnoreCase("OFF")) {
//                    this.batchInsert = false;
//                } else if (batchString.equalsIgnoreCase("ON")) {
//                    this.batchInsert = true;
//                } else {
//                    LOGGER.trace("WARNING, unrecognized batchmode type");
//                    this.batchInsert = false;
//                }
//            } else if (this.batchInsert) {
//                ZZKK = "select count(*) from pg_settings where name = 'support_batch_bind' and setting = 'on';";
//                boolean flag = false;
//                Statement stmt = null;
//                ResultSet rs = null;
//
//                try {
//                    stmt = this.createStatement();
//                    rs = stmt.executeQuery("select count(*) from pg_settings where name = 'support_batch_bind' and setting = 'on';");
//
//                    while(rs.next()) {
//                        if (rs.getInt(1) == 1) {
//                            flag = true;
//                        }
//                    }
//                } catch (SQLException var52) {
//                    LOGGER.trace("Failed to create statement or execute query, Error: " + var52.getMessage());
//                } finally {
//                    try {
//                        if (rs != null) {
//                            rs.close();
//                        }
//                    } catch (SQLException var49) {
//                        LOGGER.trace("Failed to close resultset,Error:" + var49.getMessage());
//                    }
//
//                    try {
//                        if (stmt != null) {
//                            stmt.close();
//                        }
//                    } catch (SQLException var48) {
//                        LOGGER.trace("Failed to close statement,Error:" + var48.getMessage());
//                    }
//
//                }
//
//                if (!flag) {
//                    LOGGER.trace("WARNING, client suggest to use batch mode while the server is not supported");
//                    this.batchInsert = false;
//                }
//            }
//
//            ZZKK = info.getProperty("ZZKK");
//            if (ZZKK != null && ZZKK.equalsIgnoreCase("ON")) {
//                this.forZZKK = true;
//                this._typeCache.addCoreType("VARCHAR", 25, 12, "java.lang.String", 1009);
//                this._typeCache.addCoreType("DATE", 9040, 91, "java.lang.timestamp", 9073);
//            }
//
//            String oraBlob = info.getProperty("oraBlobMode");
//            if (oraBlob != null && oraBlob.equalsIgnoreCase("ON")) {
//                this.oraBlobMode = true;
//            }
//
//            this.initClientLogic(info);
//        }
//    }
//
//    private void initClientLogic(Properties info) throws SQLException {
//        if (PGProperty.PG_CLIENT_LOGIC.get(info) != null && PGProperty.PG_CLIENT_LOGIC.get(info).equals("1")) {
//            String autoBalance = info.getProperty("autoBalance");
//            String targetType = info.getProperty("targetServerType");
//            if (autoBalance != null && !autoBalance.equals("false") || targetType != null) {
//                LOGGER.error("[client encryption] Failed connecting to client logic as autobalance or targetType is set");
//                this.clientLogic = null;
//                throw new PSQLException(GT.tr("Failed connecting to client logic", new Object[0]), PSQLState.INVALID_PARAMETER_VALUE);
//            }
//
//            LOGGER.trace("Initiating client logic");
//
//            try {
//                this.clientLogic = new ClientLogic();
//                String databaseName = PGProperty.PG_DBNAME.get(info);
//                this.clientLogic.linkClientLogic(databaseName, this);
//            } catch (ClientLogicException var5) {
//                this.clientLogic = null;
//                LOGGER.error("Failed connecting to client logic");
//                throw new PSQLException(GT.tr("Failed connecting to client logic" + var5.getMessage(), new Object[0]), PSQLState.INVALID_PARAMETER_VALUE);
//            }
//        } else {
//            LOGGER.trace("Client logic is off");
//        }
//
//    }
//
//    private static Set<Integer> getBinaryOids(Properties info) throws PSQLException {
//        boolean binaryTransfer = false;
//        binaryTransfer = PGProperty.BINARY_TRANSFER.getBoolean(info);
//        Set<Integer> binaryOids = new HashSet(32);
//        if (binaryTransfer) {
//            binaryOids.add(17);
//            binaryOids.add(21);
//            binaryOids.add(23);
//            binaryOids.add(20);
//            binaryOids.add(700);
//            binaryOids.add(701);
//            binaryOids.add(1083);
//            binaryOids.add(1082);
//            binaryOids.add(1266);
//            binaryOids.add(1114);
//            binaryOids.add(1184);
//            binaryOids.add(1005);
//            binaryOids.add(1007);
//            binaryOids.add(1016);
//            binaryOids.add(1021);
//            binaryOids.add(1022);
//            binaryOids.add(1015);
//            binaryOids.add(3968);
//            binaryOids.add(1009);
//            binaryOids.add(600);
//            binaryOids.add(603);
//            binaryOids.add(2950);
//        }
//
//        binaryOids.addAll(getOidSet(PGProperty.BINARY_TRANSFER_ENABLE.get(info)));
//        binaryOids.removeAll(getOidSet(PGProperty.BINARY_TRANSFER_DISABLE.get(info)));
//        return binaryOids;
//    }
//
//    private static Set<Integer> getOidSet(String oidList) throws PSQLException {
//        Set<Integer> oids = new HashSet();
//        StringTokenizer tokenizer = new StringTokenizer(oidList, ",");
//
//        while(tokenizer.hasMoreTokens()) {
//            String oid = tokenizer.nextToken();
//            oids.add(Oid.valueOf(oid));
//        }
//
//        return oids;
//    }
//
//    private String oidsToString(Set<Integer> oids) {
//        StringBuilder sb = new StringBuilder();
//        Iterator var3 = oids.iterator();
//
//        while(var3.hasNext()) {
//            Integer oid = (Integer)var3.next();
//            sb.append(Oid.toString(oid));
//            sb.append(',');
//        }
//
//        if (sb.length() > 0) {
//            sb.setLength(sb.length() - 1);
//        } else {
//            sb.append(" <none>");
//        }
//
//        return sb.toString();
//    }
//
//    private String getConnectionInfo(boolean withExtraInfo, Properties info) {
//        String connectionInfo = "";
//        String gsVersion = null;
//        String driverPath = null;
//        String OSUser = null;
//        String urlConfiguration = null;
//        gsVersion = Driver.getGSVersion();
//        if (withExtraInfo) {
//            OSUser = System.getProperty("user.name");
//
//            try {
//                File jarDir = new File(Driver.class.getProtectionDomain().getCodeSource().getLocation().toURI());
//                driverPath = jarDir.getCanonicalPath();
//            } catch (URISyntaxException var9) {
//                driverPath = "";
//                LOGGER.trace("Failed to make connection_info as there is an exception: " + var9.getMessage());
//            } catch (IOException var10) {
//                driverPath = "";
//                LOGGER.trace("Failed to make connection_info as there is an exception: " + var10.getMessage());
//            } catch (IllegalArgumentException var11) {
//                driverPath = "";
//                LOGGER.trace("Failed to make connection_info as there is an exception: " + var11.getMessage());
//            }
//
//            urlConfiguration = this.reassembleUrl(info);
//        }
//
//        connectionInfo = "{\"driver_name\":\"JDBC\",\"driver_version\":\"" + gsVersion.replace("\"", "\\\"") + "\"";
//        if (withExtraInfo && driverPath != null) {
//            connectionInfo = connectionInfo + ",\"driver_path\":\"" + driverPath.replace("\\", "\\\\").replace("\"", "\\\"") + "\",\"os_user\":\"" + OSUser.replace("\"", "\\\"") + "\",\"urlConfiguration\":\"" + urlConfiguration.replace("\"", "\\\"") + "\"";
//        }
//
//        connectionInfo = connectionInfo + "}";
//        return connectionInfo;
//    }
//
//    private String reassembleUrl(Properties info) {
//        StringBuffer urlConfiguration = new StringBuffer();
//        if (this.creatingURL.startsWith("jdbc:postgresql:")) {
//            urlConfiguration.append("jdbc:postgresql://");
//        } else if (this.creatingURL.startsWith("jdbc:dws:iam:")) {
//            urlConfiguration.append("jdbc:dws:iam://");
//        } else if (this.creatingURL.startsWith("jdbc:opengauss:")) {
//            urlConfiguration.append("jdbc:opengauss://");
//        } else {
//            urlConfiguration.append("jdbc:gaussdb://");
//        }
//
//        String[] ports = info.getProperty("PGPORTURL").split(",");
//        String[] hosts = info.getProperty("PGHOSTURL").split(",", ports.length);
//
//        for(int i = 0; i < hosts.length; ++i) {
//            urlConfiguration.append(hosts[i] + ":" + ports[i] + ",");
//        }
//
//        urlConfiguration.deleteCharAt(urlConfiguration.length() - 1);
//        urlConfiguration.append("/" + info.getProperty("PGDBNAME") + "?");
//        Iterator var7 = info.stringPropertyNames().iterator();
//
//        while(var7.hasNext()) {
//            String propertyName = (String)var7.next();
//            if (CONNECTION_INFO_REPORT_BLACK_LIST.get(propertyName) == null) {
//                urlConfiguration.append(propertyName + "=" + info.getProperty(propertyName) + "&");
//            }
//        }
//
//        urlConfiguration.deleteCharAt(urlConfiguration.length() - 1);
//        return urlConfiguration.toString();
//    }
//
//    public TimestampUtils getTimestampUtils() {
//        return this.timestampUtils;
//    }
//
//    public Statement createStatement() throws SQLException {
//        return this.createStatement(1003, 1007);
//    }
//
//    public PreparedStatement prepareStatement(String sql) throws SQLException {
//        return this.prepareStatement(sql, 1003, 1007);
//    }
//
//    public CallableStatement prepareCall(String sql) throws SQLException {
//        return this.prepareCall(sql, 1003, 1007);
//    }
//
//    public Map<String, Class<?>> getTypeMap() throws SQLException {
//        this.checkClosed();
//        return this.typemap;
//    }
//
//    public QueryExecutor getQueryExecutor() {
//        return this.queryExecutor;
//    }
//
//    public ReplicationProtocol getReplicationProtocol() {
//        return this.queryExecutor.getReplicationProtocol();
//    }
//
//    public void addWarning(SQLWarning warn) {
//        if (this.firstWarning != null) {
//            this.firstWarning.setNextWarning(warn);
//        } else {
//            this.firstWarning = warn;
//        }
//
//    }
//
//    public ResultSet execSQLQuery(String s) throws SQLException {
//        return this.execSQLQuery(s, 1003, 1007);
//    }
//
//    public ResultSet execSQLQuery(String s, int resultSetType, int resultSetConcurrency) throws SQLException {
//        BaseStatement stat = (BaseStatement)this.createStatement(resultSetType, resultSetConcurrency);
//
//        boolean hasResultSet;
//        for(hasResultSet = stat.executeWithFlags(s, 16); !hasResultSet && stat.getUpdateCount() != -1; hasResultSet = stat.getMoreResults()) {
//        }
//
//        if (!hasResultSet) {
//            throw new PSQLException(GT.tr("No results were returned by the query.", new Object[0]), PSQLState.NO_DATA);
//        } else {
//            SQLWarning warnings = stat.getWarnings();
//            if (warnings != null) {
//                this.addWarning(warnings);
//            }
//
//            return stat.getResultSet();
//        }
//    }
//
//    public void execSQLUpdate(String s) throws SQLException {
//        BaseStatement stmt = (BaseStatement)this.createStatement();
//        if (stmt.executeWithFlags(s, 22)) {
//            throw new PSQLException(GT.tr("A result was returned when none was expected.", new Object[0]), PSQLState.TOO_MANY_RESULTS);
//        } else {
//            SQLWarning warnings = stmt.getWarnings();
//            if (warnings != null) {
//                this.addWarning(warnings);
//            }
//
//            stmt.close();
//        }
//    }
//
//    public void setCursorName(String cursor) throws SQLException {
//        this.checkClosed();
//    }
//
//    public String getCursorName() throws SQLException {
//        this.checkClosed();
//        return null;
//    }
//
//    public String getURL() throws SQLException {
//        return this.creatingURL;
//    }
//
//    public String getUserName() throws SQLException {
//        return this.queryExecutor.getUser();
//    }
//
//    public Fastpath getFastpathAPI() throws SQLException {
//        this.checkClosed();
//        if (this.fastpath == null) {
//            this.fastpath = new Fastpath(this);
//        }
//
//        return this.fastpath;
//    }
//
//    public LargeObjectManager getLargeObjectAPI() throws SQLException {
//        this.checkClosed();
//        if (this.largeobject == null) {
//            this.largeobject = new LargeObjectManager(this);
//        }
//
//        return this.largeobject;
//    }
//
//    public Object getObject(String type, String value, byte[] byteValue) throws SQLException {
//        Class c;
//        if (this.typemap != null) {
//            c = (Class)this.typemap.get(type);
//            if (c != null) {
//                throw new PSQLException(GT.tr("Custom type maps are not supported.", new Object[0]), PSQLState.NOT_IMPLEMENTED);
//            }
//        }
//
//        c = null;
//        if (LOGGER.isTraceEnabled()) {
//            LOGGER.trace("Constructing object from type=" + type + " value=<" + value + ">");
//        }
//
//        try {
//            Class<? extends PGobject> klass = this._typeCache.getPGobject(type);
//            PGobject obj;
//            if (klass != null) {
//                obj = (PGobject)klass.newInstance();
//                obj.setType(type);
//                if (byteValue != null && obj instanceof PGBinaryObject) {
//                    PGBinaryObject binObj = (PGBinaryObject)obj;
//                    binObj.setByteValue(byteValue, 0);
//                } else {
//                    obj.setValue(value);
//                }
//            } else {
//                obj = new PGobject();
//                obj.setType(type);
//                obj.setValue(value);
//            }
//
//            return obj;
//        } catch (SQLException var7) {
//            throw var7;
//        } catch (Exception var8) {
//            throw new PSQLException(GT.tr("Failed to create object for: {0}.", new Object[]{type}), PSQLState.CONNECTION_FAILURE, var8);
//        }
//    }
//
//    protected TypeInfo createTypeInfo(BaseConnection conn, int unknownLength) {
//        return new TypeInfoCache(conn, unknownLength);
//    }
//
//    public TypeInfo getTypeInfo() {
//        return this._typeCache;
//    }
//
//    public void addDataType(String type, String name) {
//        try {
//            this.addDataType(type, Class.forName(name).asSubclass(PGobject.class));
//        } catch (Exception var4) {
//            throw new RuntimeException("Cannot register new type: " + var4);
//        }
//    }
//
//    public void addDataType(String type, Class<? extends PGobject> klass) throws SQLException {
//        this.checkClosed();
//        this._typeCache.addDataType(type, klass);
//    }
//
//    private void initObjectTypes(Properties info) throws SQLException {
//        this.addDataType("box", PGbox.class);
//        this.addDataType("circle", PGcircle.class);
//        this.addDataType("line", PGline.class);
//        this.addDataType("lseg", PGlseg.class);
//        this.addDataType("path", PGpath.class);
//        this.addDataType("point", PGpoint.class);
//        this.addDataType("polygon", PGpolygon.class);
//        this.addDataType("money", PGmoney.class);
//        this.addDataType("interval", PGInterval.class);
//        Enumeration<?> e = info.propertyNames();
//
//        while(e.hasMoreElements()) {
//            String propertyName = (String)e.nextElement();
//            if (propertyName.startsWith("datatype.")) {
//                String typeName = propertyName.substring(9);
//                String className = info.getProperty(propertyName);
//
//                Class klass;
//                try {
//                    klass = Class.forName(className);
//                } catch (ClassNotFoundException var8) {
//                    throw new PSQLException(GT.tr("Unable to load the class {0} responsible for the datatype {1}", new Object[]{className, typeName}), PSQLState.SYSTEM_ERROR, var8);
//                }
//
//                this.addDataType(typeName, klass.asSubclass(PGobject.class));
//            }
//        }
//
//    }
//
//    public ClientLogic getClientLogic() {
//        return this.clientLogic;
//    }
//
//    public void close() throws SQLException {
//        if (this.clientLogic != null) {
//            this.clientLogic.close();
//            this.clientLogic = null;
//        }
//
//        if (this.exitCommit && !this.autoCommit) {
//            this.commit();
//        }
//
//        if (this.queryExecutor != null) {
//            this.releaseTimer();
//            this.queryExecutor.close();
//            this.openStackTrace = null;
//        }
//    }
//
//    public String nativeSQL(String sql) throws SQLException {
//        this.checkClosed();
//        CachedQuery cachedQuery = this.queryExecutor.createQuery(sql, false, true, new String[0]);
//        return cachedQuery.query.getNativeSql();
//    }
//
//    public synchronized SQLWarning getWarnings() throws SQLException {
//        this.checkClosed();
//        SQLWarning newWarnings = this.queryExecutor.getWarnings();
//        if (this.firstWarning == null) {
//            this.firstWarning = newWarnings;
//        } else {
//            this.firstWarning.setNextWarning(newWarnings);
//        }
//
//        return this.firstWarning;
//    }
//
//    public synchronized void clearWarnings() throws SQLException {
//        this.checkClosed();
//        this.queryExecutor.getWarnings();
//        this.firstWarning = null;
//    }
//
//    public void setReadOnly(boolean readOnly) throws SQLException {
//        this.checkClosed();
//        if (this.queryExecutor.getTransactionState() != TransactionState.IDLE) {
//            throw new PSQLException(GT.tr("Cannot change transaction read-only property in the middle of a transaction.", new Object[0]), PSQLState.ACTIVE_SQL_TRANSACTION);
//        } else {
//            if (this.allowReadOnly) {
//                if (readOnly != this.readOnly) {
//                    String readOnlySql = "SET SESSION CHARACTERISTICS AS TRANSACTION " + (readOnly ? "READ ONLY" : "READ WRITE");
//                    this.execSQLUpdate(readOnlySql);
//                }
//
//                this.readOnly = readOnly;
//                LOGGER.debug("  setReadOnly = " + readOnly);
//            } else {
//                LOGGER.debug("Cannot change transaction read-only property when the property allowReadOnly is set to false");
//            }
//
//        }
//    }
//
//    public boolean isReadOnly() throws SQLException {
//        this.checkClosed();
//        return this.readOnly;
//    }
//
//    public void setAutoCommit(boolean autoCommit) throws SQLException {
//        this.checkClosed();
//        if (this.autoCommit != autoCommit) {
//            if (!this.autoCommit) {
//                this.commit();
//            }
//
//            this.autoCommit = autoCommit;
//            LOGGER.debug("  setAutoCommit = " + autoCommit);
//        }
//    }
//
//    public boolean getAutoCommit() throws SQLException {
//        this.checkClosed();
//        return this.autoCommit;
//    }
//
//    private void executeTransactionCommand(Query query) throws SQLException {
//        try {
//            this.getQueryExecutor().execute(query, (ParameterList)null, new TransactionCommandHandler(), 0, 0, 22);
//        } catch (SQLException var3) {
//            if (query.getSubqueries() != null || !this.queryExecutor.willHealOnRetry(var3)) {
//                throw var3;
//            }
//
//            query.close();
//            this.getQueryExecutor().execute(query, (ParameterList)null, new TransactionCommandHandler(), 0, 0, 22);
//        }
//
//    }
//
//    public void commit() throws SQLException {
//        this.checkClosed();
//        if (this.autoCommit) {
//            throw new PSQLException(GT.tr("Cannot commit when autoCommit is enabled.", new Object[0]), PSQLState.NO_ACTIVE_SQL_TRANSACTION);
//        } else {
//            if (this.queryExecutor.getTransactionState() != TransactionState.IDLE) {
//                this.executeTransactionCommand(this.commitQuery);
//            }
//
//        }
//    }
//
//    protected void checkClosed() throws SQLException {
//        if (this.isClosed()) {
//            throw new PSQLException(GT.tr("This connection has been closed.", new Object[0]), PSQLState.CONNECTION_DOES_NOT_EXIST);
//        }
//    }
//
//    public void rollback() throws SQLException {
//        this.checkClosed();
//        if (this.autoCommit) {
//            throw new PSQLException(GT.tr("Cannot rollback when autoCommit is enabled.", new Object[0]), PSQLState.NO_ACTIVE_SQL_TRANSACTION);
//        } else {
//            if (this.queryExecutor.getTransactionState() != TransactionState.IDLE) {
//                this.executeTransactionCommand(this.rollbackQuery);
//            }
//
//        }
//    }
//
//    public TransactionState getTransactionState() {
//        return this.queryExecutor.getTransactionState();
//    }
//
//    public int getTransactionIsolation() throws SQLException {
//        this.checkClosed();
//        String level = null;
//        ResultSet rs = this.execSQLQuery("SHOW TRANSACTION ISOLATION LEVEL");
//        if (rs.next()) {
//            level = rs.getString(1);
//        }
//
//        rs.close();
//        if (level == null) {
//            return 2;
//        } else {
//            level = level.toUpperCase(Locale.US);
//            if (level.equals("READ COMMITTED")) {
//                return 2;
//            } else if (level.equals("READ UNCOMMITTED")) {
//                return 1;
//            } else if (level.equals("REPEATABLE READ")) {
//                return 4;
//            } else {
//                return level.equals("SERIALIZABLE") ? 8 : 2;
//            }
//        }
//    }
//
//    public void setTransactionIsolation(int level) throws SQLException {
//        this.checkClosed();
//        if (this.queryExecutor.getTransactionState() != TransactionState.IDLE) {
//            throw new PSQLException(GT.tr("Cannot change transaction isolation level in the middle of a transaction.", new Object[0]), PSQLState.ACTIVE_SQL_TRANSACTION);
//        } else {
//            String isolationLevelName = this.getIsolationLevelName(level);
//            if (isolationLevelName == null) {
//                throw new PSQLException(GT.tr("Transaction isolation level {0} not supported.", new Object[]{level}), PSQLState.NOT_IMPLEMENTED);
//            } else {
//                String isolationLevelSQL = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL " + isolationLevelName;
//                this.execSQLUpdate(isolationLevelSQL);
//                LOGGER.debug("  setTransactionIsolation = " + isolationLevelName);
//            }
//        }
//    }
//
//    protected String getIsolationLevelName(int level) {
//        switch (level) {
//            case 1:
//                return "READ UNCOMMITTED";
//            case 2:
//                return "READ COMMITTED";
//            case 3:
//            case 5:
//            case 6:
//            case 7:
//            default:
//                return null;
//            case 4:
//                return "REPEATABLE READ";
//            case 8:
//                return "SERIALIZABLE";
//        }
//    }
//
//    public void setCatalog(String catalog) throws SQLException {
//        this.checkClosed();
//        setSchema(catalog);
//    }
//
//    public String getCatalog() throws SQLException {
//        this.checkClosed();
//        return this.queryExecutor.getDatabase();
//    }
//
//    protected void finalize() throws Throwable {
//        if (this.openStackTrace != null) {
//            LOGGER.warn(GT.tr("Finalizing a Connection that was never closed:", new Object[0]), this.openStackTrace);
//        }
//
//        this.close();
//    }
//
//    public String getDBVersionNumber() {
//        return this.queryExecutor.getServerVersion();
//    }
//
//    public int getServerMajorVersion() {
//        try {
//            StringTokenizer versionTokens = new StringTokenizer(this.queryExecutor.getServerVersion(), ".");
//            return integerPart(versionTokens.nextToken());
//        } catch (NoSuchElementException var2) {
//            return 0;
//        }
//    }
//
//    public int getServerMinorVersion() {
//        try {
//            StringTokenizer versionTokens = new StringTokenizer(this.queryExecutor.getServerVersion(), ".");
//            versionTokens.nextToken();
//            return integerPart(versionTokens.nextToken());
//        } catch (NoSuchElementException var2) {
//            return 0;
//        }
//    }
//
//    public boolean haveMinimumServerVersion(int ver) {
//        return this.queryExecutor.getServerVersionNum() >= ver;
//    }
//
//    public boolean haveMinimumServerVersion(Version ver) {
//        return this.haveMinimumServerVersion(ver.getVersionNum());
//    }
//
//    public Encoding getEncoding() {
//        return this.queryExecutor.getEncoding();
//    }
//
//    public byte[] encodeString(String str) throws SQLException {
//        try {
//            return this.getEncoding().encode(str);
//        } catch (IOException var3) {
//            throw new PSQLException(GT.tr("Unable to translate data into the desired encoding.", new Object[0]), PSQLState.DATA_ERROR, var3);
//        }
//    }
//
//    public String escapeString(String str) throws SQLException {
//        return Utils.escapeLiteral((StringBuilder)null, str, this.queryExecutor.getStandardConformingStrings()).toString();
//    }
//
//    public boolean getStandardConformingStrings() {
//        return this.queryExecutor.getStandardConformingStrings();
//    }
//
//    public boolean isClosed() throws SQLException {
//        return this.queryExecutor.isClosed();
//    }
//
//    public void cancelQuery() throws SQLException {
//        this.checkClosed();
//
//        try {
//            this.queryExecutor.sendQueryCancel();
//        } catch (SQLException var2) {
//            this.queryExecutor.close();
//        }
//
//    }
//
//    public PGNotification[] getNotifications() throws SQLException {
//        return this.getNotifications(-1);
//    }
//
//    public PGNotification[] getNotifications(int timeoutMillis) throws SQLException {
//        this.checkClosed();
//        this.getQueryExecutor().processNotifies(timeoutMillis);
//        PGNotification[] notifications = this.queryExecutor.getNotifications();
//        return notifications.length == 0 ? null : notifications;
//    }
//
//    public boolean isForZZKK() {
//        return this.forZZKK;
//    }
//
//    public Boolean getOraBlobMode() {
//        return this.oraBlobMode;
//    }
//
//    public int getPrepareThreshold() {
//        return this.prepareThreshold;
//    }
//
//    public void setDefaultFetchSize(int fetchSize) throws SQLException {
//        if (fetchSize < 0) {
//            throw new PSQLException(GT.tr("Fetch size must be a value greater to or equal to 0.", new Object[0]), PSQLState.INVALID_PARAMETER_VALUE);
//        } else {
//            this.defaultFetchSize = fetchSize;
//        }
//    }
//
//    public int getDefaultFetchSize() {
//        return this.defaultFetchSize;
//    }
//
//    public void setPrepareThreshold(int newThreshold) {
//        this.prepareThreshold = newThreshold;
//    }
//
//    public boolean getForceBinary() {
//        return this.forcebinary;
//    }
//
//    public void setForceBinary(boolean newValue) {
//        this.forcebinary = newValue;
//    }
//
//    public void setTypeMapImpl(Map<String, Class<?>> map) throws SQLException {
//        this.typemap = map;
//    }
//
//    public Log getLogger() {
//        return LOGGER;
//    }
//
//    public int getProtocolVersion() {
//        return this.queryExecutor.getProtocolVersion();
//    }
//
//    public boolean getStringVarcharFlag() {
//        return this.bindStringAsVarchar;
//    }
//
//    public CopyManager getCopyAPI() throws SQLException {
//        this.checkClosed();
//        if (this.copyManager == null) {
//            this.copyManager = new CopyManager(this);
//        }
//
//        return this.copyManager;
//    }
//
//    public boolean binaryTransferSend(int oid) {
//        return this.queryExecutor.useBinaryForSend(oid);
//    }
//
//    public boolean isColumnSanitiserDisabled() {
//        return this.disableColumnSanitiser;
//    }
//
//    public void setDisableColumnSanitiser(boolean disableColumnSanitiser) {
//        this.disableColumnSanitiser = disableColumnSanitiser;
//        LOGGER.debug("  setDisableColumnSanitiser = " + disableColumnSanitiser);
//    }
//
//    public PreferQueryMode getPreferQueryMode() {
//        return this.queryExecutor.getPreferQueryMode();
//    }
//
//    public AutoSave getAutosave() {
//        return this.queryExecutor.getAutoSave();
//    }
//
//    public void setAutosave(AutoSave autoSave) {
//        this.queryExecutor.setAutoSave(autoSave);
//        LOGGER.debug("  setAutosave = " + autoSave.value());
//    }
//
//    protected void abort() {
//        this.queryExecutor.abort();
//    }
//
//    private synchronized Timer getTimer() {
//        if (this.cancelTimer == null) {
//            this.cancelTimer = Driver.getSharedTimer().getTimer();
//        }
//
//        return this.cancelTimer;
//    }
//
//    private synchronized void releaseTimer() {
//        if (this.cancelTimer != null) {
//            this.cancelTimer = null;
//            Driver.getSharedTimer().releaseTimer();
//        }
//
//    }
//
//    public void addTimerTask(TimerTask timerTask, long milliSeconds) {
//        Timer timer = this.getTimer();
//        timer.schedule(timerTask, milliSeconds);
//    }
//
//    public void purgeTimerTasks() {
//        Timer timer = this.cancelTimer;
//        if (timer != null) {
//            timer.purge();
//        }
//
//    }
//
//    public String escapeIdentifier(String identifier) throws SQLException {
//        return Utils.escapeIdentifier((StringBuilder)null, identifier).toString();
//    }
//
//    public String escapeLiteral(String literal) throws SQLException {
//        return Utils.escapeLiteral((StringBuilder)null, literal, this.queryExecutor.getStandardConformingStrings()).toString();
//    }
//
//    public LruCache<FieldMetadata.Key, FieldMetadata> getFieldMetadataCache() {
//        return this.fieldMetadataCache;
//    }
//
//    public PGReplicationConnection getReplicationAPI() {
//        return new PGReplicationConnectionImpl(this);
//    }
//
//    public DbCompatibility getDbCompatibility() {
//        return this.dbCompatibility;
//    }
//
//    public void setDbCompatibility(DbCompatibility dbCompatibility) {
//        this.dbCompatibility = dbCompatibility;
//    }
//
//    private static void appendArray(StringBuilder sb, Object elements, char delim) {
//        sb.append('{');
//        int nElements = Array.getLength(elements);
//
//        for(int i = 0; i < nElements; ++i) {
//            if (i > 0) {
//                sb.append(delim);
//            }
//
//            Object o = Array.get(elements, i);
//            if (o == null) {
//                sb.append("NULL");
//            } else if (o.getClass().isArray()) {
//                PrimitiveArraySupport arraySupport = PrimitiveArraySupport.getArraySupport(o);
//                if (arraySupport != null) {
//                    arraySupport.appendArray(sb, delim, o);
//                } else {
//                    appendArray(sb, o, delim);
//                }
//            } else {
//                String s = o.toString();
//                PgArray.escapeArrayElement(sb, s);
//            }
//        }
//
//        sb.append('}');
//    }
//
//    private static int integerPart(String dirtyString) {
//        int start;
//        for(start = 0; start < dirtyString.length() && !Character.isDigit(dirtyString.charAt(start)); ++start) {
//        }
//
//        int end;
//        for(end = start; end < dirtyString.length() && Character.isDigit(dirtyString.charAt(end)); ++end) {
//        }
//
//        return start == end ? 0 : Integer.parseInt(dirtyString.substring(start, end));
//    }
//
//    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
//        this.checkClosed();
//        return new PgStatement(this, resultSetType, resultSetConcurrency, resultSetHoldability);
//    }
//
//    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
//        this.checkClosed();
//        return (PreparedStatement)(DbCompatibility.MYSQL == this.dbCompatibility ? new MySQLCmptPreparedStatement(this, sql, resultSetType, resultSetConcurrency, resultSetHoldability) : new OracleCmptPreparedStatement(this, sql, resultSetType, resultSetConcurrency, resultSetHoldability));
//    }
//
//    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
//        this.checkClosed();
//        return new PgCallableStatement(this, sql, resultSetType, resultSetConcurrency, resultSetHoldability);
//    }
//
//    public DatabaseMetaData getMetaData() throws SQLException {
//        this.checkClosed();
//        if (this.metadata == null) {
//            this.metadata = new PgDatabaseMetaData(this);
//        }
//
//        return this.metadata;
//    }
//
//    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
//        this.setTypeMapImpl(map);
//        LOGGER.debug("  setTypeMap = " + map);
//    }
//
//    protected java.sql.Array makeArray(int oid, String fieldString) throws SQLException {
//        return new PgArray(this, oid, fieldString);
//    }
//
//    protected Blob makeBlob(long oid) throws SQLException {
//        return new PgBlob(this, oid);
//    }
//
//    protected Clob makeClob(long oid) throws SQLException {
//        return new PgClob(this, oid);
//    }
//
//    protected SQLXML makeSQLXML() throws SQLException {
//        return new PgSQLXML(this);
//    }
//
//    public Clob createClob() throws SQLException {
//        this.checkClosed();
//        return new PGClob();
//    }
//
//    public Blob createBlob() throws SQLException {
//        this.checkClosed();
//        return new PGBlob();
//    }
//
//    public NClob createNClob() throws SQLException {
//        this.checkClosed();
//        throw Driver.notImplemented(this.getClass(), "createNClob()");
//    }
//
//    public SQLXML createSQLXML() throws SQLException {
//        this.checkClosed();
//        return this.makeSQLXML();
//    }
//
//    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
//        this.checkClosed();
//        throw Driver.notImplemented(this.getClass(), "createStruct(String, Object[])");
//    }
//
//    public java.sql.Array createArrayOf(String typeName, Object elements) throws SQLException {
//        this.checkClosed();
//        TypeInfo typeInfo = this.getTypeInfo();
//        int oid = typeInfo.getPGArrayType(typeName);
//        char delim = typeInfo.getArrayDelimiter(oid);
//        if (oid == 0) {
//            throw new PSQLException(GT.tr("Unable to find server array type for provided name {0}.", new Object[]{typeName}), PSQLState.INVALID_NAME);
//        } else if (elements == null) {
//            return this.makeArray(oid, (String)null);
//        } else {
//            PrimitiveArraySupport arraySupport = PrimitiveArraySupport.getArraySupport(elements);
//            String arrayString;
//            if (arraySupport != null) {
//                if (oid == arraySupport.getDefaultArrayTypeOid(typeInfo) && arraySupport.supportBinaryRepresentation() && this.getPreferQueryMode() != PreferQueryMode.SIMPLE) {
//                    return new PgArray(this, oid, arraySupport.toBinaryRepresentation(this, elements));
//                }
//
//                arrayString = arraySupport.toArrayString(delim, elements);
//            } else {
//                Class<?> clazz = elements.getClass();
//                if (!clazz.isArray()) {
//                    throw new PSQLException(GT.tr("Invalid elements {0}", new Object[]{elements}), PSQLState.INVALID_PARAMETER_TYPE);
//                }
//
//                StringBuilder sb = new StringBuilder();
//                appendArray(sb, elements, delim);
//                arrayString = sb.toString();
//            }
//
//            return this.makeArray(oid, arrayString);
//        }
//    }
//
//    public java.sql.Array createArrayOf(String typeName, Object[] elements) throws SQLException {
//        this.checkClosed();
//        int oid = this.getTypeInfo().getPGArrayType(typeName);
//        if (oid == 0) {
//            throw new PSQLException(GT.tr("Unable to find server array type for provided name {0}.", new Object[]{typeName}), PSQLState.INVALID_NAME);
//        } else if (elements == null) {
//            return this.makeArray(oid, (String)null);
//        } else {
//            char delim = this.getTypeInfo().getArrayDelimiter(oid);
//            StringBuilder sb = new StringBuilder();
//            appendArray(sb, elements, delim);
//            return this.makeArray(oid, sb.toString());
//        }
//    }
//
//    public boolean isValid(int timeout) throws SQLException {
//        if (timeout < 0) {
//            throw new PSQLException(GT.tr("Invalid timeout ({0}<0).", new Object[]{timeout}), PSQLState.INVALID_PARAMETER_VALUE);
//        } else if (this.isClosed()) {
//            return false;
//        } else {
//            boolean changedNetworkTimeout = false;
//
//            try {
//                int oldNetworkTimeout = this.getNetworkTimeout();
//                int newNetworkTimeout = (int)Math.min((long)timeout * 1000L, 2147483647L);
//
//                boolean var11;
//                try {
//                    if (newNetworkTimeout != 0 && (oldNetworkTimeout == 0 || newNetworkTimeout < oldNetworkTimeout)) {
//                        changedNetworkTimeout = true;
//                        this.setNetworkTimeout((Executor)null, newNetworkTimeout);
//                    }
//
//                    if (this.replicationConnection) {
//                        Statement statement = this.createStatement();
//                        statement.execute("IDENTIFY_SYSTEM");
//                        statement.close();
//                    } else {
//                        if (this.checkConnectionQuery == null) {
//                            this.checkConnectionQuery = this.prepareStatement("");
//                        }
//
//                        this.checkConnectionQuery.executeUpdate();
//                    }
//
//                    var11 = true;
//                } finally {
//                    if (changedNetworkTimeout) {
//                        this.setNetworkTimeout((Executor)null, oldNetworkTimeout);
//                    }
//
//                }
//
//                return var11;
//            } catch (SQLException var10) {
//                if (PSQLState.IN_FAILED_SQL_TRANSACTION.getState().equals(var10.getSQLState())) {
//                    return true;
//                } else {
//                    LOGGER.debug(GT.tr("Validating connection.", new Object[0]), var10);
//                    return false;
//                }
//            }
//        }
//    }
//
//    public void setClientInfo(String name, String value) throws SQLClientInfoException {
//        try {
//            this.checkClosed();
//        } catch (SQLException var8) {
//            Map<String, ClientInfoStatus> failures = new HashMap();
//            failures.put(name, ClientInfoStatus.REASON_UNKNOWN);
//            throw new SQLClientInfoException(GT.tr("This connection has been closed.", new Object[0]), failures, var8);
//        }
//
//        if ((!this.haveMinimumServerVersion(ServerVersion.v9_0) || !"ApplicationName".equals(name)) && !"ApplicationType".equals(name)) {
//            this.addWarning(new SQLWarning(GT.tr("ClientInfo property not supported.", new Object[0]), PSQLState.NOT_IMPLEMENTED.getState()));
//        } else {
//            Map<String, String> appInfo = new HashMap();
//            appInfo.put("ApplicationName", "application_name");
//            appInfo.put("ApplicationType", "application_type");
//            if (value == null) {
//                value = "";
//            }
//
//            String oldValue = "ApplicationName".equals(name) ? this.queryExecutor.getApplicationName() : this.queryExecutor.getApplicationType();
//            if (!value.equals(oldValue)) {
//                try {
//                    StringBuilder sql = new StringBuilder(String.format("SET %s = '", appInfo.get(name)));
//                    Utils.escapeLiteral(sql, value, this.getStandardConformingStrings());
//                    sql.append("'");
//                    this.execSQLUpdate(sql.toString());
//                } catch (SQLException var7) {
//                    Map<String, ClientInfoStatus> failures = new HashMap();
//                    failures.put(name, ClientInfoStatus.REASON_UNKNOWN);
//                    throw new SQLClientInfoException(GT.tr("Failed to set ClientInfo property: " + name, new Object[0]), var7.getSQLState(), failures, var7);
//                }
//
//                if (LOGGER.isDebugEnabled()) {
//                    LOGGER.debug("  setClientInfo = " + name + " " + value);
//                }
//
//                this._clientInfo.put(name, value);
//            }
//        }
//    }
//
//    public void setClientInfo(Properties properties) throws SQLClientInfoException {
//        try {
//            this.checkClosed();
//        } catch (SQLException var10) {
//            Map<String, ClientInfoStatus> failures = new HashMap();
//            Iterator var4 = properties.entrySet().iterator();
//
//            while(var4.hasNext()) {
//                Map.Entry<Object, Object> e = (Map.Entry)var4.next();
//                failures.put((String)e.getKey(), ClientInfoStatus.REASON_UNKNOWN);
//            }
//
//            throw new SQLClientInfoException(GT.tr("This connection has been closed.", new Object[0]), failures, var10);
//        }
//
//        String gaussdbVersion = this.queryExecutor.getGaussdbVersion();
//        String[] result;
//        if (gaussdbVersion.equals("GaussDBKernel")) {
//            result = new String[]{"ApplicationName", "ApplicationType"};
//        } else {
//            result = new String[]{"ApplicationName"};
//        }
//
//        Map<String, ClientInfoStatus> failures = new HashMap();
//        String[] var14 = result;
//        int var6 = result.length;
//
//        for(int var7 = 0; var7 < var6; ++var7) {
//            String name = var14[var7];
//
//            try {
//                if (!"ApplicationType".equals(name) || properties.getProperty(name) != null) {
//                    this.setClientInfo(name, properties.getProperty(name, (String)null));
//                }
//            } catch (SQLClientInfoException var11) {
//                failures.putAll(var11.getFailedProperties());
//            }
//        }
//
//        if (!failures.isEmpty()) {
//            throw new SQLClientInfoException(GT.tr("One or more ClientInfo failed.", new Object[0]), PSQLState.NOT_IMPLEMENTED.getState(), failures);
//        }
//    }
//
//    public String getClientInfo(String name) throws SQLException {
//        this.checkClosed();
//        this._clientInfo.put("ApplicationName", this.queryExecutor.getApplicationName());
//        this._clientInfo.put("ApplicationType", this.queryExecutor.getApplicationType());
//        return this._clientInfo.getProperty(name);
//    }
//
//    public Properties getClientInfo() throws SQLException {
//        this.checkClosed();
//        this._clientInfo.put("ApplicationName", this.queryExecutor.getApplicationName());
//        this._clientInfo.put("ApplicationType", this.queryExecutor.getApplicationType());
//        return this._clientInfo;
//    }
//
//    public <T> T createQueryObject(Class<T> ifc) throws SQLException {
//        this.checkClosed();
//        throw Driver.notImplemented(this.getClass(), "createQueryObject(Class<T>)");
//    }
//
//    public boolean isWrapperFor(Class<?> iface) throws SQLException {
//        this.checkClosed();
//        return iface.isAssignableFrom(this.getClass());
//    }
//
//    public <T> T unwrap(Class<T> iface) throws SQLException {
//        this.checkClosed();
//        if (iface.isAssignableFrom(this.getClass())) {
//            return iface.cast(this);
//        } else {
//            throw new SQLException("Cannot unwrap to " + iface.getName());
//        }
//    }
//
//    public String getSchema() throws SQLException {
//        this.checkClosed();
//        Statement stmt = this.createStatement();
//
//        String var3;
//        try {
//            ResultSet rs = stmt.executeQuery("select current_schema()");
//
//            try {
//                if (rs.next()) {
//                    var3 = rs.getString(1);
//                    return var3;
//                }
//
//                var3 = null;
//            } finally {
//                rs.close();
//            }
//        } finally {
//            stmt.close();
//        }
//
//        return var3;
//    }
//
//    public void setSchema(String schema) throws SQLException {
//        this.checkClosed();
//        Statement stmt = this.createStatement();
//
//        try {
//            if (schema == null) {
//                stmt.executeUpdate("SET SESSION search_path TO DEFAULT");
//            } else {
//                StringBuilder sb = new StringBuilder();
//                sb.append("SET SESSION search_path TO '");
//                Utils.escapeLiteral(sb, schema, this.getStandardConformingStrings());
//                sb.append("'");
//                stmt.executeUpdate(sb.toString());
//                LOGGER.debug("  setSchema = " + schema);
//            }
//        } finally {
//            stmt.close();
//        }
//
//    }
//
//    public void abort(Executor executor) throws SQLException {
//        if (!this.isClosed()) {
//            SQL_PERMISSION_ABORT.checkGuard(this);
//            AbortCommand command = new AbortCommand();
//            if (executor != null) {
//                executor.execute(command);
//            } else {
//                command.run();
//            }
//
//        }
//    }
//
//    public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
//        this.checkClosed();
//        if (milliseconds < 0) {
//            throw new PSQLException(GT.tr("Network timeout must be a value greater than or equal to 0.", new Object[0]), PSQLState.INVALID_PARAMETER_VALUE);
//        } else {
//            SecurityManager securityManager = System.getSecurityManager();
//            if (securityManager != null) {
//                securityManager.checkPermission(SQL_PERMISSION_NETWORK_TIMEOUT);
//            }
//
//            try {
//                this.queryExecutor.setNetworkTimeout(milliseconds);
//            } catch (IOException var5) {
//                throw new PSQLException(GT.tr("Unable to set network timeout.", new Object[0]), PSQLState.COMMUNICATION_ERROR, var5);
//            }
//        }
//    }
//
//    public int getNetworkTimeout() throws SQLException {
//        this.checkClosed();
//
//        try {
//            return this.queryExecutor.getNetworkTimeout();
//        } catch (IOException var2) {
//            throw new PSQLException(GT.tr("Unable to get network timeout.", new Object[0]), PSQLState.COMMUNICATION_ERROR, var2);
//        }
//    }
//
//    public void setHoldability(int holdability) throws SQLException {
//        this.checkClosed();
//        switch (holdability) {
//            case 1:
//                this.rsHoldability = holdability;
//                break;
//            case 2:
//                this.rsHoldability = holdability;
//                break;
//            default:
//                throw new PSQLException(GT.tr("Unknown ResultSet holdability setting: {0}.", new Object[]{holdability}), PSQLState.INVALID_PARAMETER_VALUE);
//        }
//
//        LOGGER.debug("  setHoldability = " + holdability);
//    }
//
//    public int getHoldability() throws SQLException {
//        this.checkClosed();
//        return this.rsHoldability;
//    }
//
//    public Savepoint setSavepoint() throws SQLException {
//        this.checkClosed();
//        if (this.getAutoCommit()) {
//            throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode.", new Object[0]), PSQLState.NO_ACTIVE_SQL_TRANSACTION);
//        } else {
//            PSQLSavepoint savepoint = new PSQLSavepoint(this.savepointId++);
//            String pgName = savepoint.getPGName();
//            Statement stmt = this.createStatement();
//            stmt.executeUpdate("SAVEPOINT " + pgName);
//            stmt.close();
//            return savepoint;
//        }
//    }
//
//    public Savepoint setSavepoint(String name) throws SQLException {
//        this.checkClosed();
//        if (this.getAutoCommit()) {
//            throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode.", new Object[0]), PSQLState.NO_ACTIVE_SQL_TRANSACTION);
//        } else {
//            PSQLSavepoint savepoint = new PSQLSavepoint(name);
//            Statement stmt = this.createStatement();
//            stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName());
//            stmt.close();
//            return savepoint;
//        }
//    }
//
//    public void rollback(Savepoint savepoint) throws SQLException {
//        this.checkClosed();
//        PSQLSavepoint pgSavepoint = (PSQLSavepoint)savepoint;
//        this.execSQLUpdate("ROLLBACK TO SAVEPOINT " + pgSavepoint.getPGName());
//    }
//
//    public void releaseSavepoint(Savepoint savepoint) throws SQLException {
//        this.checkClosed();
//        PSQLSavepoint pgSavepoint = (PSQLSavepoint)savepoint;
//        this.execSQLUpdate("RELEASE SAVEPOINT " + pgSavepoint.getPGName());
//        pgSavepoint.invalidate();
//    }
//
//    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
//        this.checkClosed();
//        return this.createStatement(resultSetType, resultSetConcurrency, this.getHoldability());
//    }
//
//    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
//        this.checkClosed();
//        return this.prepareStatement(sql, resultSetType, resultSetConcurrency, this.getHoldability());
//    }
//
//    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
//        this.checkClosed();
//        return this.prepareCall(sql, resultSetType, resultSetConcurrency, this.getHoldability());
//    }
//
//    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
//        return autoGeneratedKeys != 1 ? this.prepareStatement(sql) : this.prepareStatement(sql, (String[])null);
//    }
//
//    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
//        if (columnIndexes != null && columnIndexes.length == 0) {
//            return this.prepareStatement(sql);
//        } else {
//            this.checkClosed();
//            throw new PSQLException(GT.tr("Returning autogenerated keys is not supported.", new Object[0]), PSQLState.NOT_IMPLEMENTED);
//        }
//    }
//
//    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
//        if (columnNames != null && columnNames.length == 0) {
//            return this.prepareStatement(sql);
//        } else {
//            if (columnNames != null && DbCompatibility.ORACLE == this.dbCompatibility) {
//                for(int i = 0; i < columnNames.length; ++i) {
//                    columnNames[i] = columnNames[i].toLowerCase();
//                }
//            }
//
//            CachedQuery cachedQuery = this.borrowReturningQuery(sql, columnNames);
//            PgPreparedStatement ps = new PgPreparedStatement(this, cachedQuery, 1003, 1007, this.getHoldability());
//            Query query = cachedQuery.query;
//            SqlCommand sqlCommand = query.getSqlCommand();
//            if (sqlCommand != null) {
//                ps.wantsGeneratedKeysAlways = sqlCommand.isReturningKeywordPresent();
//            }
//
//            return ps;
//        }
//    }
//
//    public PGXmlFactoryFactory getXmlFactoryFactory() throws SQLException {
//        if (this.xmlFactoryFactory == null) {
//            if (this.xmlFactoryFactoryClass != null && !this.xmlFactoryFactoryClass.equals("")) {
//                if (this.xmlFactoryFactoryClass.equals("LEGACY_INSECURE")) {
//                    this.xmlFactoryFactory = LegacyInsecurePGXmlFactoryFactory.INSTANCE;
//                } else {
//                    Class clazz;
//                    try {
//                        clazz = Class.forName(this.xmlFactoryFactoryClass);
//                    } catch (ClassNotFoundException var4) {
//                        throw new PSQLException(GT.tr("Could not instantiate xmlFactoryFactory: {0}", new Object[]{this.xmlFactoryFactoryClass}), PSQLState.INVALID_PARAMETER_VALUE, var4);
//                    }
//
//                    if (!clazz.isAssignableFrom(PGXmlFactoryFactory.class)) {
//                        throw new PSQLException(GT.tr("Connection property xmlFactoryFactory must implement PGXmlFactoryFactory: {0}", new Object[]{this.xmlFactoryFactoryClass}), PSQLState.INVALID_PARAMETER_VALUE);
//                    }
//
//                    try {
//                        this.xmlFactoryFactory = (PGXmlFactoryFactory)clazz.newInstance();
//                    } catch (Exception var3) {
//                        throw new PSQLException(GT.tr("Could not instantiate xmlFactoryFactory: {0}", new Object[]{this.xmlFactoryFactoryClass}), PSQLState.INVALID_PARAMETER_VALUE, var3);
//                    }
//                }
//            } else {
//                this.xmlFactoryFactory = DefaultPGXmlFactoryFactory.INSTANCE;
//            }
//        }
//
//        return this.xmlFactoryFactory;
//    }
//
//    public boolean isBatchInsert() {
//        return this.batchInsert;
//    }
//
//    public boolean isBlobMode() {
//        return this.blobmode;
//    }
//
//    public boolean isTimeTextMode() {
//        return this.timeTextMode;
//    }
//
//    public int getFetchSize() {
//        return this.fetchSize;
//    }
//
//    public void setFetchSize(int fetchSize) {
//        this.fetchSize = fetchSize;
//    }
//
//    public String getSocketAddress() {
//        return this.socketAddress;
//    }
//
//    public BulkloadManager getBulkloadAPI() throws SQLException {
//        this.checkClosed();
//        if (this.bulkloadManager == null) {
//            this.bulkloadManager = new BulkloadManager(this, this.bulkloadCtlFile);
//        }
//
//        return this.bulkloadManager;
//    }
//
//    public Boolean checkVastBaseVersion(String version) {
//        String vbVersion = this.getQueryExecutor().getVastBaseCoreVersion();
//        String[] svb = vbVersion.split("\\.");
//        String[] vb = version.split("\\.");
//
//        for(int i = 0; i < svb.length; ++i) {
//            if (i >= vb.length) {
//                return true;
//            }
//
//            if (Integer.parseInt(svb[i]) > Integer.parseInt(vb[i])) {
//                return true;
//            }
//
//            if (Integer.parseInt(svb[i]) < Integer.parseInt(vb[i])) {
//                return false;
//            }
//        }
//
//        return true;
//    }
//
//    public String getVastBaseVersion() {
//        return this.getQueryExecutor().getVastBaseCoreVersion();
//    }
//
//    static {
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("user", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("sslcert", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("password", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("sslkey", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("sslpassword", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("PGHOSTURL", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("PGPORTURL", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("PGPORT", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("PGHOST", "");
//        CONNECTION_INFO_REPORT_BLACK_LIST.put("PGDBNAME", "");
//    }
//
//    public class AbortCommand implements Runnable {
//        public AbortCommand() {
//        }
//
//        public void run() {
//            PgConnection.this.abort();
//        }
//    }
//
//    private class TransactionCommandHandler extends ResultHandlerBase {
//        private TransactionCommandHandler() {
//        }
//
//        public void handleCompletion() throws SQLException {
//            SQLWarning warning = this.getWarning();
//            if (warning != null) {
//                PgConnection.this.addWarning(warning);
//            }
//
//            super.handleCompletion();
//        }
//    }
//}
